package com.crawler.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class NativeDrive {
	private volatile static Connection connection =  null;
	private NativeDrive(){}
	
	public static Connection getInstence(){
		if(connection==null){
			synchronized (NativeDrive.class) {
				if(connection==null){
					try {
						Class.forName("com.mysql.jdbc.Driver");
						connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/book3?useUnicode=true&characterEncoding=UTF-8&useSSL=true", "root", "123456");
					} catch (ClassNotFoundException | SQLException e) {
						e.printStackTrace();
					}
				}
			}
		}
		return connection;
	}
}
